﻿@model IEnumerable<SGC_CarteraClientes.Models.CA_CANAL_DISTRIBUCION>

@{
    ViewBag.Title = "Gestión de Canales";
}

<h2>Canales de Distribución</h2>
@if (TempData["message"] != null && TempData["message"].ToString().Trim()!="")
{
@Html.Raw(TempData["message"].ToString())
//@TempData["message"] = null;
} 
<hr />
    @Html.ActionLink("Nuevo Canal", "Create")
            @Html.ActionLink("Volver", "../")

<table class="tblSort">
    <thead>
    <tr>
        <th>
            @Html.DisplayName("Código")
            @*@Html.DisplayNameFor(model => model.CANAL_ID)*@
        </th>
        <th>
            @Html.DisplayName("Descripción")
            @*@Html.DisplayNameFor(model => model.CANAL_DESCRIP)*@
        </th>
        <th>
            @Html.DisplayName("F. Ini Vig")
            @*@Html.DisplayNameFor(model => model.CANAL_FINICIO)*@
        </th>
        <th>
            @Html.DisplayName("F. Fin Vig")
            @*@Html.DisplayNameFor(model => model.CANAL_FFIN)*@
        </th>
        <th>
            @Html.DisplayName("Tipo Canal")
            @*@Html.DisplayNameFor(model => model.CA_TIPOCANAL.TIPOCANAL_DESCRIP)*@
        </th>
        <th>
            @Html.DisplayName("Estado")
            @*@Html.DisplayNameFor(model => model.CANAL_ESTADO)*@
        </th>
       
        <th></th>
        
    </tr>
        </thead><tbody>
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.CANAL_ID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CANAL_DESCRIP)
        </td>
        <td>
            @item.CANAL_FINICIO.Value.ToShortDateString()
        </td>
        <td>
            @item.CANAL_FFIN.Value.ToShortDateString()
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CA_TIPOCANAL.TIPOCANAL_DESCRIP)
        </td>
        <td align="center">
           @* @Html.DisplayFor(modelItem => item.CANAL_ESTADO) *@
            @if (item.CANAL_ESTADO == "1") { 
             <img src="/Images/active.png"  width="25px" />   
            }
            else {
                <img src="/Images/inactive.png"  width="25px" />        
            }
        </td>
       
        <td>@if (item.CANAL_ESTADO == "1") {
            @Html.ActionLink("Modificar", "Edit", new {  id=item.CANAL_ID})} else {
            @Html.ActionLink("Activar", "Edit", new {  id=item.CANAL_ID})} |
            @Html.ActionLink("Ver", "Details", new { id=item.CANAL_ID }) |
            @if (item.CANAL_ESTADO == "1"){
            @Html.ActionLink("Desactivar", "Delete", new { id=item.CANAL_ID })}
        </td>
    </tr>
}
            </tbody>

</table>
